﻿using System;
using System.Windows.Data;
using VIA.Integration;

namespace VIA.Presentation.Converters
{
    public class AutomaticEditorEnableConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if(value is IObject obj)
            {
              return  EditorFactory.Default.IsEditable(obj);
            }
            return false;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
